package com.uenpay.im.ui.old.activity.chat.manage;

import android.text.TextUtils;

import com.qyx.android.message.type.MenuMsgType;
import com.uenpay.im.IMApplication;
import com.uenpay.im.R;
import com.uenpay.im.entities.TalkLongClickViewEntity;
import com.uenpay.im.entities.chatbean.MsgGifModel;

import java.util.ArrayList;

/**
 * @author SL
 * @created 2016-4-23 下午1:26:52
 * @copyRight http://www.qiyunxin.com
 * @function 消息对象长按文本信息管理
 */
public class ChatLongClickTextManage {

	/**
	 * 获取文本长按显示的数据
	 *
	 * @return
	 */
	public static ArrayList<TalkLongClickViewEntity> getTextData(
			String from_cust_id) {
		ArrayList<TalkLongClickViewEntity> arrayList = new ArrayList<TalkLongClickViewEntity>();
		TalkLongClickViewEntity mTalkLongClickViewEntity1 = new TalkLongClickViewEntity(
				MenuMsgType.COPY, R.string.copy);
		TalkLongClickViewEntity mTalkLongClickViewEntity2 = new TalkLongClickViewEntity(
				MenuMsgType.FORWARD, R.string.Forwarding);
		TalkLongClickViewEntity mTalkLongClickViewEntity3 = new TalkLongClickViewEntity(
				MenuMsgType.DELETE, R.string.delete);
		TalkLongClickViewEntity mTalkLongClickViewEntity4 = new TalkLongClickViewEntity(
				MenuMsgType.COLLECT, R.string.collect);
		TalkLongClickViewEntity mTalkLongClickViewEntity5 = new TalkLongClickViewEntity(
				MenuMsgType.WITHDRAW, R.string.withdraw);
		arrayList.add(mTalkLongClickViewEntity1);
		arrayList.add(mTalkLongClickViewEntity2);
		arrayList.add(mTalkLongClickViewEntity3);
		arrayList.add(mTalkLongClickViewEntity4);
		/** 发送方显示撤回消息 **/
		if (from_cust_id.equals(IMApplication.getCustId())) {
			arrayList.add(mTalkLongClickViewEntity5);
		}
		return arrayList;
	}

	/**
	 * 获取图片长按显示的数据
	 *
	 * @return
	 */
	public static ArrayList<TalkLongClickViewEntity> getImageData(
			String from_cust_id) {
		ArrayList<TalkLongClickViewEntity> arrayList = new ArrayList<TalkLongClickViewEntity>();
		TalkLongClickViewEntity mTalkLongClickViewEntity2 = new TalkLongClickViewEntity(
				MenuMsgType.FORWARD, R.string.Forwarding);
		TalkLongClickViewEntity mTalkLongClickViewEntity3 = new TalkLongClickViewEntity(
				MenuMsgType.DELETE, R.string.delete);
		TalkLongClickViewEntity mTalkLongClickViewEntity4 = new TalkLongClickViewEntity(
				MenuMsgType.COLLECT, R.string.collect);
		TalkLongClickViewEntity mTalkLongClickViewEntity5 = new TalkLongClickViewEntity(
				MenuMsgType.WITHDRAW, R.string.withdraw);
		arrayList.add(mTalkLongClickViewEntity2);
		arrayList.add(mTalkLongClickViewEntity3);
		arrayList.add(mTalkLongClickViewEntity4);
		/** 发送方显示撤回消息 **/
		if (from_cust_id.equals(IMApplication.getCustId())) {
			arrayList.add(mTalkLongClickViewEntity5);
		}
		return arrayList;
	}

	/**
	 * 获取长按GIF显示的数据
	 *
	 * @param from_cust_id
	 * @param msgGifModel
	 * @return
	 */
	public static ArrayList<TalkLongClickViewEntity> getGifData(
			String from_cust_id, MsgGifModel msgGifModel) {
		ArrayList<TalkLongClickViewEntity> arrayList = new ArrayList<TalkLongClickViewEntity>();
		TalkLongClickViewEntity mTalkLongClickViewEntity2 = new TalkLongClickViewEntity(
				MenuMsgType.FORWARD, R.string.Forwarding);
		TalkLongClickViewEntity mTalkLongClickViewEntity3 = new TalkLongClickViewEntity(
				MenuMsgType.DELETE, R.string.delete);
		TalkLongClickViewEntity mTalkLongClickViewEntity5 = new TalkLongClickViewEntity(
				MenuMsgType.WITHDRAW, R.string.withdraw);
		arrayList.add(mTalkLongClickViewEntity2);
		arrayList.add(mTalkLongClickViewEntity3);
		/** 发送方显示撤回消息 **/
		if (from_cust_id.equals(IMApplication.getCustId())) {
			arrayList.add(mTalkLongClickViewEntity5);
		}

		if (msgGifModel != null
				&& !TextUtils.isEmpty(msgGifModel.getFileHash())
				&& !TextUtils.isEmpty(msgGifModel.getFileId())) {
			String stickerStr = IMApplication.config
					.getCustomFaceJson(IMApplication.getCustId());
			if (!TextUtils.isEmpty(stickerStr)) {
				/** 收藏列表中无该表情显示添加 **/
				if (stickerStr.indexOf(msgGifModel.getFileId()) == -1
						&& stickerStr.indexOf(msgGifModel.getFileId()) == -1) {
					TalkLongClickViewEntity mTalkLongClickViewEntity6 = new TalkLongClickViewEntity(
							MenuMsgType.ADD_TO_STICKERS,
							R.string.add_to_sticker);
					arrayList.add(mTalkLongClickViewEntity6);
				}
			} else {
				TalkLongClickViewEntity mTalkLongClickViewEntity6 = new TalkLongClickViewEntity(
						MenuMsgType.ADD_TO_STICKERS, R.string.add_to_sticker);
				arrayList.add(mTalkLongClickViewEntity6);
			}
		}
		return arrayList;
	}

	/**
	 * 获取其他长按显示的数据
	 *
	 * @return
	 */
	public static ArrayList<TalkLongClickViewEntity> getOtherData(
			String from_cust_id) {
		ArrayList<TalkLongClickViewEntity> arrayList = new ArrayList<TalkLongClickViewEntity>();
		TalkLongClickViewEntity mTalkLongClickViewEntity2 = new TalkLongClickViewEntity(
				MenuMsgType.FORWARD, R.string.Forwarding);
		TalkLongClickViewEntity mTalkLongClickViewEntity3 = new TalkLongClickViewEntity(
				MenuMsgType.DELETE, R.string.delete);
		TalkLongClickViewEntity mTalkLongClickViewEntity5 = new TalkLongClickViewEntity(
				MenuMsgType.WITHDRAW, R.string.withdraw);
		arrayList.add(mTalkLongClickViewEntity2);
		arrayList.add(mTalkLongClickViewEntity3);
		/** 发送方显示撤回消息 **/
		if (from_cust_id.equals(IMApplication.getCustId())) {
			arrayList.add(mTalkLongClickViewEntity5);
		}
		return arrayList;
	}

	/**
	 * 获取只有删除的长按数据
	 *
	 * @return
	 */
	public static ArrayList<TalkLongClickViewEntity> getOnlyDeleteData() {
		ArrayList<TalkLongClickViewEntity> arrayList = new ArrayList<TalkLongClickViewEntity>();
		TalkLongClickViewEntity mTalkLongClickViewEntity3 = new TalkLongClickViewEntity(
				MenuMsgType.DELETE, R.string.delete);
		arrayList.add(mTalkLongClickViewEntity3);
		return arrayList;
	}
}
